#!bin/bash
dt=`date -d '1 days ago' '+%Y-%m-%d'`

#ods_to_dwd
nohup hive -hivevar etl_dt="$dt" -f '/root/hive/ods_to_dwd/full_add.sql' & > /root/hive/ods_to_dwd/ods_to_dwd.log
nohup hive -hivevar etl_dt="$dt" -f '/root/hive/ods_to_dwd/inc_add.sql'  & > /root/hive/ods_to_dwd/ods_to_dwd.log
if [ $? -ne 0 ]
then
	echo "执行失败"
	exit
fi

#dwd_to_dws
nohup hive -hivevar etl_dt="$dt" -f '/root/hive/dwd_to_dws/inc_add.sql' & > /root/hive/dwd_to_dws/dwd_to_dws.log
if [ $? -ne 0 ]
then
	echo "执行失败"
	exit
fi

#dws_to_ads
nohup hive -hivevar -f '/root/hive/dws_to_ads/full_overwrite.sql' & > /root/hive/dws_to_ads/dws_to_ads.log
if [ $? -ne 0 ]
then
	echo "执行失败"
fi